<?php
require_once ('admin.php');
$sucessful = 0;
$error = array();
$fileName = '';
$ok = 1;
/*
 * Submit
 */
if (isset($_REQUEST['publish_product'])) {

    if ($_REQUEST['name'] == "") {

        $error['name'] = "Name can not be blank";
        $ok = 0;
    }

    if ($_REQUEST['email'] == "") {

        $error['email'] = "Email can not be blank";
        $ok = 0;
    } else {

        $email_address = $_REQUEST['email'];
        if (!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", $email_address)) {
            $error['email'] = "\nInvalid email address";
            $ok = 0;
        }
    }
 

    if ($_REQUEST['phone'] == "") {
        $error['phone'] = 'Going to can not be blank';
        $ok = 0;
    }

    if ($_REQUEST['start_time'] == "") {
        $error['start_time'] = "Start time can not be blank";
        $ok = 0;
    }

    $dsStartime = $_REQUEST['start_time'];
    $all_tong = $_REQUEST['all_tab'];

    $ds_startTime_all = "";
    for ($i = 0; $i < $all_tong; $i++) {

        $val = $dsStartime[$i];
        $j = (int) $i + 1;
        if ($val == "") {


            $error['start_time' . $j] = "Start time can not be blank";
            $ok = 0;
        } else {
            $ds_startTime_all[$i] = $val;
        }
    }

    if ($_REQUEST['end_time'] == "") {


        $ok = 0;
    }
    $dsEndtime = $_REQUEST['end_time'];

    $ds_EndTime_all = "";
    for ($i = 0; $i < $all_tong; $i++) {

        $val = $dsEndtime[$i];
        $j = (int) $i + 1;
        if ($val == "") {


            $error['end_time' . $j] = "End time can not be blank";
            $ok = 0;
        } else {
            $ds_EndTime_all[$i] = $val;
        }
    }

    $ds_loc = $_REQUEST['start-location'];    

    $ds_startlocation_all = "";
    for ($i = 0; $i < $all_tong; $i++) {

        $val = $ds_loc[$i];
        $j = (int) $i + 1;
        if ($val == "") {


            $error['start_location' . $j] = "Leaving from can not be blank";
            $ok = 0;
        } else {
            $ds_startlocation_all[$i] = $val;
        }
    }
    
    $ds_endloc = $_REQUEST['end_location'];
    $ds_endlocation_all = "";
    for ($i = 0; $i < $all_tong; $i++) {

        $val = $ds_endloc[$i];
        $j = (int) $i + 1;
        if ($val == "") {


            $error['end_location' . $j] = 'Going to can not be blank';
            $ok = 0;
        } else {
            $ds_endlocation_all[$i] = $val;
        }
    }
    // echo $featured;
    if ($ok == 1) {
        $fullName = $_REQUEST['name'];
        $email = $_REQUEST['email'];
        $address = $_REQUEST['address'];
        $phone = $_REQUEST['phone'];
        $endLocation = $_REQUEST['end_location'];
        $startTime = $_REQUEST['start_time'];
        $endTime = $_REQUEST['end_time'];
        $adult = $_REQUEST['adult'];
        $children = $_REQUEST['children'];
        $infant = $_REQUEST['infant'];
        $class = $_REQUEST['class'];
        $country = $_REQUEST['city'];
        $sucessful = 1;
	
	//store data
        RequestAQoute::updateRequestCustomerGenneral($_REQUEST['id'], $fullName, $email,$_REQUEST['address'], $phone,
		$ds_startlocation_all, $ds_endlocation_all, $ds_startTime_all, $ds_EndTime_all, $adult, $children, $infant, 
		$class, $country, $_REQUEST['price']);	        
	
	//send invoice
	MailHelper::sendInvoice($_REQUEST['id'], $email, $fullName, $ds_startlocation_all, $ds_endlocation_all
		, $ds_startTime_all, $ds_EndTime_all, $adult, $children, $infant, $class, $country, $_REQUEST['price']);
	
    }
}

/**
 * Link Management Administration Screen.
 */
/** Load WordPress Administration Bootstrap */
global $current_user;
if (isset($_REQUEST['id'])) {


    $idRequestAQuote = $_REQUEST['id'];

    $listCustomer = RequestAQoute::ListCustomerbyIdRequestAQuote($idRequestAQuote);
} else {

    wp_redirect('404.php');
}
?>
<?php
$wp_list_table = _get_list_table('WP_Links_List_Table');
$doaction = $wp_list_table->current_action();

if ($doaction && isset($_REQUEST['linkcheck'])) {
    check_admin_referer('bulk-bookmarks');
    if ('delete' == $doaction) {
        $bulklinks = (array) $_REQUEST['linkcheck'];
        foreach ($bulklinks as $link_id) {
            $link_id = (int) $link_id;
            wp_delete_link($link_id);
        }
        wp_redirect(add_query_arg('deleted', count($bulklinks), admin_url('link-manager.php')));
        exit;
    }
} elseif (!empty($_GET['_wp_http_referer'])) {
    wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI'])));
    exit;
}
$wp_list_table->prepare_items();
$title = __('Add customer');
$this_file = $parent_file = 'customer-list.php';
get_current_screen()->add_help_tab(array(
    'id' => 'overview',
    'title' => __('Overview'),
    'content' =>
    '<p>' . sprintf(__('You can add links here to be displayed on your site, usually using <a href="%s">Widgets</a>. By default, links to several sites in the WordPress community are included as examples.'), 'widgets.php') . '</p>' .
    '<p>' . __('Links may be separated into Link Categories; these are different than the categories used on your posts.') . '</p>' .
    '<p>' . __('You can customize the display of this screen using the Screen Options tab and/or the dropdown filters above the links table.') . '</p>'
));

get_current_screen()->add_help_tab(array(
    'id' => 'deleting-links',
    'title' => __('Deleting Links'),
    'content' =>
    '<p>' . __('If you delete a link, it will be removed permanently, as Links do not have a Trash function yet.') . '</p>'
));



get_current_screen()->set_help_sidebar(
        '<p><strong>' . __('For more information:') . '</strong></p>' .
        '<p>' . __('<a href="http://codex.wordpress.org/Links_Screen" target="_blank">Documentation on Managing Links</a>') . '</p>' .
        '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
);


if (!current_user_can('read'))
    wp_die(__("You do not have sufficient permissions to edit the links for this site."));
?>



<?php
include_once ('./admin-header.php');


//print_r($listCustomer);
?>
<link rel="stylesheet" type="text/css" href="css/tuan.css"/>
<link rel="stylesheet" type="text/css" href="css/tham.css"/>
<div class="wrap nosubsub">
    <h2>Generate Invoice<?php
        if (!empty($_REQUEST['s']))
            printf('<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html(wp_unslash($_REQUEST['s'])));
        ?>
    </h2>
   
    <form id="posts-filter" method="post"  enctype="multipart/form-data"> 
        <?php $wp_list_table->search_box(__('Search Links'), 'link'); ?>
        <hr>
        <div style="width:100%; background:#FDFDFD">
	     <?php 
		if ($sucessful == 1) {
		    ?>
		    <div class="alert alert-success">You have sent the invoice to customer's email successfully</div>
		<?php
		}?>
            <table width="707"  height="77" cellspacing="0" >
                <tr>
                    <th width="138" valign="top"  scope="row" align="left">
                        <label for="siteupdates">
                            <p class="labelp"><?php _e('Name') ?> (*)</p>  
                        </label>
                    </th>
                    <td width="563"  valign="top">
                        <div style="margin-top:10px;">:  			    
                            <input  style="width:80%; height:30px;" name="name" type="text" id="name"   
                                    value="<?Php
                                    echo $listCustomer[0]->full_name;
                                    ?>"  class="regular-text"> 
                            <span class="errorclass"><Br/><?php echo $error['name']; ?></span>
                        </div>
                    </td>
                </tr>

                <tr>
                    <th width="138" valign="top"  scope="row" align="left">
                        <label for="siteupdates">
                            <p class="labelp" ><?php _e('Email'); ?> (*)</p> 
                        </label>
                    </th>
                    <td width="563"  valign="top">
                        :
                        <input  style="width:80%; height:30px;" name="email" type="text" id="email"   
                                value="<?Php
                                echo $listCustomer[0]->email;
                                ?>"  class="regular-text"> 
                        <span class="errorclass"><Br/><?php echo $error['email']; ?></span>
                    </td>
                </tr>

               
                <input type='hidden' style="width:80%; height:30px;"  name='address' value='<?php  echo $listCustomer[0]->address; ?>'/>
                <tr>
                    <th width="138" valign="top"  scope="row" align="left"><label for="siteupdates">
                            <p class="labelp" ><?php _e('Phone') ?>
                                (*)</p> </label>
                    </th>
                    <td width="563"  valign="top">
                        <div style="margin-top:10px; margin-left:5px;">:
                            <input type='text' style="width:80%; height:30px;"  name='phone' 
                                   value='<?Php
                                   echo $listCustomer[0]->phone;
                                   ?>'/>
                            <span class="errorclass"><br/><?php echo $error['phone']; ?></span>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="5">


                        <?php
                        $startLocation = $listCustomer[0]->start_location;
                        $liststartLocation = unserialize($startLocation);
                        if (isset($_REQUEST['all_tab'])) {
                            $allTab = $_REQUEST['all_tab'];
                        } else {
                            $allTab = count($liststartLocation);
                        }
                        ?>
                        <div class="border_tabel_all">
                            <table style="width: 100%" class="tab_1" >
                                <tr>
                                    <th width="138" valign="top"  scope="row" align="left">
                                        <label for="siteupdates">
                                            <p class="labelp" ><?php _e('Leaving from') ?></p> 
                                        </label>
                                    </th>
                                    <td width="563"  valign="top"  class="td-type-flight">
                                        <div  class="class_div_td" >:<input class="inputclass1" value="<?php
                                            $startLocation = $listCustomer[0]->start_location;
                                            $liststartLocation = unserialize($startLocation);
                                            $n = count($liststartLocation);

                                            print_r($liststartLocation[0]);

                                            // echo $liststartLocation[0];
                                            ?>" placeholder="Enter City/airport" type="text"id="leaving-from" name="start-location[]">
                                            <span class="errorclass" >
                                                <?php echo $error['start_location1']; ?>
                                            </span>
                                        </div>
                                    </td>
                                </tr>


                                <tr>
                                    <th width="138" valign="top"  scope="row" align="left">
                                        <label for="siteupdates">
                                            <p class="labelp" ><?php _e('Going to') ?></p> 
                                        </label>
                                    </th>
                                    <td width="563"  valign="top" class="td-type-flight" >
                                        <div   class="class_div_td" > : <input class="inputclass1"  value="<?php
                                            $endLocation = $listCustomer[0]->end_location;
                                            $listendLocation = unserialize($endLocation);

                                            echo $listendLocation[0];
                                            ?>" placeholder="Enter City/airport" type="text" id="end_location" name="end_location[]">
                                            <span class="errorclass"><?php echo $error['end_location1']; ?></span>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <th width="138" valign="top"  scope="row" align="left" >
                                        <label for="siteupdates"> Departure date</label>
                                    </th>
                                    <td width="563"  valign="top" >
                                        <div  class="class_div_td" >:
                                            <input class="inputclass3"  value="<?php
                                            $startdate = $listCustomer[0]->start_time;
                                            $liststartdate = unserialize($startdate);
                                            $n = count($liststartdate);
                                            $startdate = $liststartdate[0];

                                            // echo $startdate;
                                            // $Liststartdate = @explode(" ", $startdate);
                                            echo $startdate;
                                            ?>" id="start_time"    type="text" name="start_time[]" />
                                            <img id="image_bt_start_time"   width="20px;" src="<?php echo get_template_directory_uri(); ?>/images/icon_datetime.png"/>
                                            <p class="errorclass"><?php echo $error['start_time1']; ?></p>
                                        </div>
                                    </td>
                                </tr>


                                <tr>
                                    <th width="138" valign="top"  scope="row" align="left" >
                                        <label for="siteupdates"> Return date</label>
                                    </th>
                                    <td width="563"  valign="top" >
                                        <div  class="class_div_td" >
                                            : <input  value="<?php
                                            //$startdate =  $listCustomer[0]->end_time; 
                                            $endTime = $listCustomer[0]->end_time;
                                            $listEndTime = unserialize($endTime);
                                            $endTime = $listEndTime[0];

                                            // echo $startdate;
                                            // $Liststartdate = @explode(" ", $startdate);
                                            echo $endTime;
                                            ?>" id="end_time"  class="inputclass3"   type="text" name="end_time[]" />
                                            <img id="image_bt_end_time" width="20px;" src="<?php echo get_template_directory_uri(); ?>/images/icon_datetime.png"/>
                                            <p class="errorclass"><?php echo $error['end_time1']; ?></p>
                                        </div>
                                    </td>

                                </tr>


                            </table>
                            <table <?php
                            if ($allTab >= 2) {
                                echo ' style="display: block!important"  ';
                            }
                            ?> class="tab_2 class_border_top"   >
                                <tr>
                                    <th width="138" valign="top"  scope="row" align="left">
                                        <label for="siteupdates">
                                            <p class="labelp" ><?php _e('Leaving from') ?></p> 
                                        </label>
                                    </th>
                                    <td width="563"  valign="top"  class="td-type-flight">
                                        <div  class="class_div_td" >:<input class="inputclass1" value="<?php
                                            $startLocation = $listCustomer[0]->start_location;
                                            $liststartLocation = unserialize($startLocation);
                                            $n = count($liststartLocation);
                                            print_r($liststartLocation[1]);
                                            ?>" placeholder="Enter City/airport" type="text" id="leaving-from" name="start-location[]">
                                            <span class="errorclass" >
                                                <?php echo $error['start_location2']; ?>





                                            </span>
                                        </div>
                                    </td>
                                </tr>


                                <tr>
                                    <th width="138" valign="top"  scope="row" align="left">
                                        <label for="siteupdates">
                                            <p class="labelp" ><?php _e('Going to') ?></p> 
                                        </label>
                                    </th>
                                    <td width="563"  valign="top" class="td-type-flight" >
                                        <div  class="class_div_td" > : <input class="inputclass"  value="<?php
                                            $endLocation = $listCustomer[0]->end_location;
                                            $listendLocation = unserialize($endLocation);
                                            $n = count($listendLocation);
                                            if ($n > 1) {
                                                print_r($listendLocation[1]);
                                            }
                                            ?>" placeholder="Enter City/airport" type="text"  id="end_location" name="end_location[]">
                                            <span class="errorclass"><?php echo $error['end_location2']; ?></span>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <th width="138" valign="top"  scope="row" align="left" >
                                        <label for="siteupdates"> Departure date</label>
                                    </th>
                                    <td width="563"  valign="top" >
                                        <div  class="class_div_td" >:
                                            <input class="inputclass3"  value="<?php
                                            $startdate = $listCustomer[0]->start_time;
                                            $liststartdate = unserialize($startdate);
                                            $n = count($liststartdate);
                                            if ($n > 1) {
                                                $startdate = $liststartdate[1];
                                            }

// echo $startdate;
// $Liststartdate = @explode(" ", $startdate);
                                            echo $startdate;
                                            ?>" id="start_time1"    type="text" name="start_time[]" />
                                            <img id="image_bt_start_time1"   width="20px;" src="<?php echo get_template_directory_uri(); ?>/images/icon_datetime.png"/>
                                            <p class="errorclass"><?php echo $error['start_time2']; ?></p>
                                        </div>
                                    </td>
                                </tr>


                                <tr>
                                    <th width="138" valign="top"  scope="row" align="left" >
                                        <label for="siteupdates"> Return date</label>
                                    </th>
                                    <td width="563"  valign="top" >
                                        <div  class="class_div_td" >: <input  value="<?php
                                            //$startdate =  $listCustomer[0]->end_time; 
                                            $endTime = $listCustomer[0]->end_time;
                                            $listEndTime = unserialize($endTime);
                                            $n = count($listEndTime);
                                            if ($n > 1) {
                                                $endTime = $listEndTime[1];
                                            }


                                            // echo $startdate;
                                            // $Liststartdate = @explode(" ", $startdate);
                                            echo $endTime;
                                            ?>" id="end_time1"  class="inputclass3"   type="text" name="end_time[]" />
                                            <img id="image_bt_end_time1" width="20px;" src="<?php echo get_template_directory_uri(); ?>/images/icon_datetime.png"/>
                                            <p class="errorclass"><?php echo $error['end_time2']; ?></p>
                                        </div>
                                    </td>
                                </tr>


                            </table>
                            <table <?php
                            if ($allTab >= 3) {
                                echo ' style="display: block!important"  ';
                            }
                            ?> class="tab_3 class_border_top"   >
                                <tr>
                                    <th width="138" valign="top"  scope="row" align="left">
                                        <label for="siteupdates">
                                            <p class="labelp" ><?php _e('Leaving from') ?></p> 
                                        </label>
                                    </th>
                                    <td width="563"  valign="top"  class="td-type-flight">
                                        <div  class="class_div_td" >:<input class="inputclass1" value="<?php
                                            $startLocation = $listCustomer[0]->start_location;
                                            $liststartLocation = unserialize($startLocation);
                                            $n = count($liststartLocation);
                                            if ($n > 1) {
                                                print_r($liststartLocation[2]);
                                            }
                                            ?>" placeholder="Enter City/airport" type="text" id="leaving-from" name="start-location[]">
                                            <span class="errorclass" >
                                                <?php echo $error['start_location3']; ?>
                                            </span>
                                        </div>
                                    </td>
                                </tr>


                                <tr>
                                    <th width="138" valign="top"  scope="row" align="left">
                                        <label for="siteupdates">
                                            <p class="labelp" ><?php _e('Going to') ?></p> 
                                        </label>
                                    </th>
                                    <td width="563"  valign="top" class="td-type-flight" >
                                        <div  class="class_div_td" > : <input class="inputclass"  value="<?php
                                            $endLocation = $listCustomer[0]->end_location;
                                            $listendLocation = unserialize($endLocation);
                                            $n = count($listendLocation);
                                            if ($n > 1) {
                                                print_r($listendLocation[2]);
                                            }
                                            ?>" placeholder="Enter City/airport" type="text"  id="end_location" name="end_location[]">
                                            <span class="errorclass"><?php echo $error['end_location3']; ?></span>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <th width="138" valign="top"  scope="row" align="left" >
                                        <label for="siteupdates"> Departure date</label>
                                    </th>
                                    <td width="563"  valign="top" >
                                        <div  class="class_div_td" >:
                                            <input class="inputclass3"  value="<?php
                                            $startdate = $listCustomer[0]->start_time;
                                            $liststartdate = unserialize($startdate);
                                            $n = count($liststartdate);
                                            if ($n > 1) {
                                                $startdate = $liststartdate[2];
                                            }

                                            // echo $startdate;
                                            // $Liststartdate = @explode(" ", $startdate);
                                            echo $startdate;
                                            ?>" id="start_time2"    type="text" name="start_time[]" />
                                            <img id="image_bt_start_time2"   width="20px;" src="<?php echo get_template_directory_uri(); ?>/images/icon_datetime.png"/>
                                            <p class="errorclass"><?php echo $error['start_time3']; ?></p>
                                        </div>

                                    </td>
                                </tr>


                                <tr>
                                    <th width="138" valign="top"  scope="row" align="left" >
                                        <label for="siteupdates"> Return date</label>
                                    </th>
                                    <td width="563"  valign="top" >
                                        <div  class="class_div_td" >  : <input  value="<?php
                                            //$startdate =  $listCustomer[0]->end_time; 
                                            $endTime = $listCustomer[0]->end_time;
                                            $listEndTime = unserialize($endTime);
                                            $n = count($listEndTime);
                                            if ($n > 1) {
                                                $endTime = $listEndTime[2];
                                            }

                                            // echo $startdate;
                                            // $Liststartdate = @explode(" ", $startdate);
                                            echo $endTime;
                                            ?>" id="end_time2"  class="inputclass3"   type="text" name="end_time[]" />
                                            <img id="image_bt_end_time2" width="20px;" src="<?php echo get_template_directory_uri(); ?>/images/icon_datetime.png"/>
                                            <p class="errorclass"><?php echo $error['end_time3']; ?></p>

                                        </div>
                                    </td>
                                </tr>


                            </table>


                            <table <?php
                            if ($allTab >= 4) {
                                echo ' style="display: block!important"  ';
                            }
                            ?> class="tab_4 class_border_top"   >
                                <tr>
                                    <th width="138" valign="top"  scope="row" align="left">
                                        <label for="siteupdates">
                                            <p class="labelp" ><?php _e('Leaving from') ?></p> 
                                        </label>
                                    </th>
                                    <td width="563"  valign="top"  class="td-type-flight">
                                        <div  class="class_div_td" >:<input class="inputclass1" value="<?php
                                            $startLocation = $listCustomer[0]->start_location;
                                            $liststartLocation = unserialize($startLocation);
                                            $n = count($liststartLocation);
                                            if ($n > 1) {
                                                print_r($liststartLocation[3]);
                                            }
                                            ?>" placeholder="Enter City/airport" type="text" id="leaving-from" name="start-location[]">
                                            <span class="errorclass" >
                                                <?php echo $error['start_location4']; ?>
                                            </span>
                                        </div>
                                    </td>
                                </tr>


                                <tr>
                                    <th width="138" valign="top"  scope="row" align="left">
                                        <label for="siteupdates">
                                            <p class="labelp" ><?php _e('Going to') ?></p> 
                                        </label>
                                    </th>
                                    <td width="563"  valign="top" class="td-type-flight" >
                                        <div  class="class_div_td" > : <input class="inputclass"  value="<?php
                                            $endLocation = $listCustomer[0]->end_location;
                                            $listendLocation = unserialize($endLocation);
                                            $n = count($listendLocation);
                                            if ($n > 1) {
                                                print_r($listendLocation[3]);
                                            }
                                            ?>" placeholder="Enter City/airport" type="text"  id="end_location" name="end_location[]">
                                            <span class="errorclass"><?php echo $error['end_location4']; ?></span>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <th width="138" valign="top"  scope="row" align="left" >
                                        <label for="siteupdates"> Departure date</label>
                                    </th>
                                    <td width="563"  valign="top" >
                                        <div  class="class_div_td" >:
                                            <input class="inputclass3"  value="<?php
                                            $startdate = $listCustomer[0]->start_time;
                                            $liststartdate = unserialize($startdate);
                                            $n = count($liststartdate);
                                            if ($n > 1) {
                                                $startdate = $liststartdate[3];
                                            }

                                            // echo $startdate;
                                            // $Liststartdate = @explode(" ", $startdate);
                                            echo $startdate;
                                            ?>" id="start_time3"    type="text" name="start_time[]" />
                                            <img id="image_bt_start_time3"   width="20px;" src="<?php echo get_template_directory_uri(); ?>/images/icon_datetime.png"/>
                                            <p class="errorclass"><?php echo $error['start_time4']; ?></p>
                                        </div>

                                    </td>
                                </tr>


                                <tr>
                                    <th width="138" valign="top"  scope="row" align="left" >
                                        <label for="siteupdates"> Return date</label>
                                    </th>
                                    <td width="563"  valign="top" >
                                        <div  class="class_div_td" >  : <input  value="<?php
                                            //$startdate =  $listCustomer[0]->end_time; 
                                            $endTime = $listCustomer[0]->end_time;
                                            $listEndTime = unserialize($endTime);
                                            $n = count($listEndTime);
                                            if ($n > 1) {
                                                $endTime = $listEndTime[3];
                                            }

                                            // echo $startdate;
                                            // $Liststartdate = @explode(" ", $startdate);
                                            echo $endTime;
                                            ?>" id="end_time3"  class="inputclass3"   type="text" name="end_time[]" />
                                            <img id="image_bt_end_time3" width="20px;" src="<?php echo get_template_directory_uri(); ?>/images/icon_datetime.png"/>
                                            <p class="errorclass"><?php echo $error['end_time4']; ?></p>

                                        </div>
                                    </td>
                                </tr>



                            </table>
                            <?php
                            if ($allTab <= 3) {
                                echo '<input type="button" class="bt_btmore" id="bt_btmore" value="Add more flights" />';
                            }
                            ?>


                            <input type="hidden" name="all_tab" id="all_tab" value="<?php echo $allTab; ?>" />
                        </div>
                    </td>
                </tr>







                <tr>
                    <th width="138" valign="top"  scope="row" align="left" >
                        <label for="siteupdates">Adult(12+) </label>
                    </th>
                    <td width="563"  valign="top" >
                        <?php
                        $adult = $listCustomer[0]->adult;
                        ?>: <select  id="adult" name="adult" class="select-find-flights inputclass2" >
                        <?php
                        for ($i = 1; $i <= 9; $i++) {
                            if ($adult == $i) {
                                echo '<option selected=selected value="' . $i . '" >' . $i . '</option>';
                            } else {
                                echo '<option value="' . $i . '" >' . $i . '</option>';
                            }
                        }
                        ?>
                        </select>
                    </td>
                </tr>
                <tr>
                    <th width="138" valign="top"  scope="row" align="left" >
                        <label for="siteupdates">Children(2-12)</label>
                    </th>
                    <td width="563"  valign="top" >
                        <?php $children = $listCustomer[0]->children; ?>
                        : <select  id="children" name="children" class="select-find-flights inputclass2" >
                            <?php
                            for ($i = 0; $i < 9; $i++) {

                                if ($i == $children) {

                                    echo '<option selected=selected  value="' . $i . '" >' . $i . '</option>';
                                } else {
                                    echo '<option value="' . $i . '" >' . $i . '</option>';
                                }
                            }
                            ?>
                        </select>
                    </td>
                </tr>
                <tr>
                    <th width="138" valign="top"  scope="row" align="left" >
                        <label for="siteupdates">Infant(0-2)</label>
                    </th>
                    <td width="563"  valign="top" >
                        <?php $infant = $listCustomer[0]->infant; ?>
                        : <select id="infant" name="infant"  class="select-find-flights inputclass2"> 

                            <option <?php
                            if ($infant == 0) {
                                echo 'selected=selected';
                            }
                            ?> >0</option>
                            <option <?php
                            if ($infant == 1) {
                                echo 'selected=selected';
                            }
                            ?> >1</option>
                        </select>
                    </td>
                </tr>

                <tr>
                    <th width="138" valign="top"  scope="row" align="left" >
                        <label for="siteupdates">Class</label>
                    </th>
                    <td width="563"  valign="top" >
                        <?php $class_f = $listCustomer[0]->class; ?>
                        :<select name="class" id="class" class="select-find-flights inputclass2">
                            <option value="<?php echo DealFlight::ECONOMY; ?>"  
                            <?php
                            if ($class_f == DealFlight::ECONOMY) {
                                echo 'selected=selected';
                            }
                            ?>>Economy</option>
                            <option value="<?php echo DealFlight::BUSINESS; ?>" 
                            <?php
                            if ($class_f == DealFlight::BUSINESS) {
                                echo 'selected=selected';
                            }
                            ?> >Business</option>
                            <option value="<?PHP echo DealFlight::FIRST_CLASS ?>" 
                            <?php
                            if ($class_f == DealFlight::FIRST_CLASS) {
                                echo 'selected=selected';
                            }
                            ?> >First Class</option>
                            <option value="<?php echo DealFlight::PREMIUM_ECONOMY ?>
                            <?php
                            if ($class_f == DealFlight::PREMIUM_ECONOMY) {
                                echo 'selected=selected';
                            }
                            ?> ">Premium Economy</option>
                        </select>
                    </td>
                </tr>

                <tr>
                    <th width="138" valign="top"  scope="row" align="left" >
                        <label >Country</label>
                    </th>
                    <td width="563"  valign="top" >

                        :<select  name="city" id="city" class="select-find-flights inputclass2" >
                            <?php
                            $city = $listCustomer[0]->city;
                            ?>
                            <option  <?php
                            if ($city == 'USA') {
                                echo 'selected="selected"';
                            }
                            ?> value="USA">USA</option>

                            <option  <?php
                            if ($city == 'India') {
                                echo 'selected="selected"';
                            }
                            ?> value="India">India</option>
                            <option value="Arab"  <?php
                            if ($city == 'Arab') {
                                echo 'selected="selected"';
                            }
                            ?> > Arab </option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <th width="138" valign="top"  scope="row" align="left" >
                        <label>Price</label>
                    </th>
                    <td width="563"  valign="top" > : <input  style="width:80%; height:30px;" name="price" type="text" id="price"   
                                    value="<?Php
                                    echo $listCustomer[0]->price;
                                    ?>"  class="regular-text"> 
                           <span class="errorclass" > <?php echo $error['price']; ?> </span>
                    </td>

                </tr>
                <tr>
                    <th valign="top"  scope="row" align="left">&nbsp;</th>
                    <td  valign="top"><div style="margin-top:10px; margin-left:5px;">
                            <input  type="submit" name="publish_product" id="publish_product" 
                                    class="button button-primary button-large" value="Send Invoice" accesskey="p">
                           
                    </td>



                </tr>
            </table>
        </div>
    </form>

</div>

<link rel="stylesheet" type="text/css" href="../wp-content/themes/travel_donald/css/jquery.datetimepicker.css" />
<script src="../wp-content/themes/travel_donald/js/jquery.js"></script>
<script src="../wp-content/themes/travel_donald/js/jquery.datetimepicker.js"></script>

<script type="text/javascript" lang="javascript">

    $('#image_bt_start_time').click(function() {
        $('#start_time').datetimepicker('show'); //support hide,show and destroy command
    });

    $('#image_bt_end_time').click(function() {
        $('#end_time').datetimepicker('show'); //support hide,show and destroy command
    });
    $(function() {
        $('#start_time').datetimepicker({
            format: 'd/m/Y',
            onShow: function(ct) {
                this.setOptions({
                    maxDate: $('#end_time').val() ? $('#end_time').val() : false
                })
            },
            timepicker: false
        });
        $('#end_time').datetimepicker({
            format: 'd/m/Y',
            onShow: function(ct) {
                this.setOptions({
                    minDate: $('#start_time').val() ? $('#start_time').val() : false
                })
            },
            timepicker: false
        });
    });

    $('#image_bt_start_time1').click(function() {
        $('#start_time1').datetimepicker('show'); //support hide,show and destroy command
    });

    $('#image_bt_end_time1').click(function() {
        $('#end_time1').datetimepicker('show'); //support hide,show and destroy command
    });
    $(function() {
        $('#start_time1').datetimepicker({
            format: 'd/m/Y',
            onShow: function(ct) {
                this.setOptions({
                    maxDate: $('#end_time1').val() ? $('#end_time1').val() : false
                })
            },
            timepicker: false
        });
        $('#end_time1').datetimepicker({
            format: 'd/m/Y',
            onShow: function(ct) {
                this.setOptions({
                    minDate: $('#start_time1').val() ? $('#start_time1').val() : false
                })
            },
            timepicker: false
        });
    });


    $('#image_bt_start_time2').click(function() {
        $('#start_time2').datetimepicker('show'); //support hide,show and destroy command
    });

    $('#image_bt_end_time2').click(function() {
        $('#end_time2').datetimepicker('show'); //support hide,show and destroy command
    });
    $(function() {
        $('#start_time2').datetimepicker({
            format: 'd/m/Y',
            onShow: function(ct) {
                this.setOptions({
                    maxDate: $('#end_time2').val() ? $('#end_time2').val() : false
                })
            },
            timepicker: false
        });
        $('#end_time2').datetimepicker({
            format: 'd/m/Y',
            onShow: function(ct) {
                this.setOptions({
                    minDate: $('#start_time2').val() ? $('#start_time2').val() : false
                })
            },
            timepicker: false
        });
    });


    $('#image_bt_start_time3').click(function() {
        $('#start_time3').datetimepicker('show'); //support hide,show and destroy command
    });

    $('#image_bt_end_time3').click(function() {
        $('#end_time3').datetimepicker('show'); //support hide,show and destroy command
    });
    $(function() {
        $('#start_time3').datetimepicker({
            format: 'd/m/Y',
            onShow: function(ct) {
                this.setOptions({
                    maxDate: $('#end_time3').val() ? $('#end_time3').val() : false
                })
            },
            timepicker: false
        });
        $('#end_time3').datetimepicker({
            format: 'd/m/Y',
            onShow: function(ct) {
                this.setOptions({
                    minDate: $('#start_time3').val() ? $('#start_time3').val() : false
                })
            },
            timepicker: false
        });
    });


    /*
     * Javascript for multi flights
     */
    $("#bt_btmore").click(function() {

        var allTab = $("#all_tab").val();
        allTab = parseInt(allTab) + 1;

        //alert(allTab);
        if (allTab < 5) {

            $(".tab_" + allTab).show();

            $("#all_tab").val(allTab);
        }
        else {
            $("#bt_btmore").hide();
        }

    });




</script>



<?php
include('./admin-footer.php');
?>

